{extends 'base/site2.html'}
{block name="page_header"}{include file="common/header.html" inline}{/block}
{block name="page_nav"}{include file="common/slide-nav.html" inline}{/block}
{block name="page_styles"}
    <link rel="stylesheet" type="text/css" href="/css/mediation/bashhandel/index.css" />
    <style>
        :not(.input-group)>.bootstrap-select.form-control:not([class*=col-]){
            width: 100%;
        }
        button {
          outline: none!important;
        }
    </style>
{/block}
{block name="page_section"}
<div class="sessionPage clearfix">
    <div class="clearfix page-header">
      <div class="left">
        <span class="line"></span>
        <strong class="tit">批量处理</strong>
      </div>
      <div class="">
        <button type="button" data-target="#modal_withdraw_case" data-toggle="modal" class="btn btn-info textright btn-xs">批量撤案</button>
        <button type="button" data-target="#modal_reallocate_case" data-toggle="modal" class="btn btn-info textright btn-xs">批量分配</button>
      </div>
    </div>
    <form method="get" action="" role="validform" enctype="multipart/form-data" class="small-style">
      <div class="form_row">
        <div class="form-group col-lg-3 ui-select">
            <label for="exampleInputName2"  class="col-sm-4 control-label">调解部门:</label>
            <div class="col-sm-7">
                <select class="form-control selectpicker" name="mediationOrganId">
                    <option class="u144_input_option" {if $query.mediationOrganId == 0}selected="selected"{/if} value="0">全部</option>
                    {foreach from=$mediationOrgan  item=info}
                        <option class="u144_input_option" {if !empty($query.mediationOrganId) &&  $info.id== $query.mediationOrganId}selected="selected"{/if} value="{$info.id}">{$info.name}</option>
                    {/foreach}
                </select>
            </div>
        </div>
          <div class="form-group col-lg-3 ui-select">
              <label for="exampleInputName2"  class="col-sm-4 control-label">导入人员:</label>
              <div class="col-sm-7">
                  <select class="form-control" id="is_contrast" name="mediatorId">
                      <option class="u144_input_option" {if $query.mediatorId==0}selected="selected"{/if} value="0">全部</option>
                      {foreach from=$mediator item=item }
                      {if $item.id != 1}
                      <option class="u144_input_option" {if $query.mediatorId == $item.id}selected="selected"{/if} value="{$item.id}">{$item.name}</option>
                      {/if}
                      {/foreach}
                  </select>
              </div>
          </div>
        <div class="form-group col-lg-3 ui-select">
            <label class="col-sm-3 control-label text-nowrap">导入时间:</label>
            <div class="col-sm-7">
                <input data-ele="date" data-type="daterange" name="add_begin_end" class="form-control" placeholder="请选择" value="{if !empty($smarty.get.add_begin_end)}{$smarty.get.add_begin_end}{/if}" autocomplete="off"/>
                {* <input data-ele="date" data-type="date" name="add_begin_end" class="form-control" placeholder="请选择" value="{if !empty($query['add_begin_end'])}{$query.add_begin_end}{/if}" autocomplete="off"/>*}
            </div>
        </div>
          <div class="form-group col-lg-3 ui-select">
              <div class="col-lg-4">
                  <button class="btn btn-primary col-lg-8 shousuoBtn "><span class="nav-icon glyphicon glyphicon-search" aria-hidden="true" style="margin-right: 2px"></span>查询</button>
              </div>
              <div class="col-lg-4">
                  <a type="button" href="/bashhandel" class="btn btn-default col-lg-8 "><span class="nav-icon glyphicon glyphicon-refresh" aria-hidden="true" style="margin-right: 2px"></span>重置</a>
              </div>
          </div>

      </div>
    </form>
    <div style="
      width: 95%;
      margin: 0 auto;
      display: flex;
      flex-direction: column;
      overflow-x: scroll;">
      <table class="table table-striped table-bordered table-hover text-nowrap" id="tab">
        <thead>
        <tr>
            <th>调解部门</th>
            <th>资产方</th>
            <th>案件导入批次ID</th>
            <th>上传数量</th>
            <th>处理数量</th>
            <th>处理类型</th>
            <th>处理状态</th>
            <th>描述</th>
            <th>导入人员</th>
            <th>导入时间</th>
            <th class="fix-ele">操作</th>
        </thead>
    <tbody>
    {if $arrList}
        {foreach from=$arrList item=item name=foo}
            <tr>
                <td>{$mediationOrgan[$item.mediationOrganId]['name']}</td>
                <td>{if $item.assetsId}{$assets[$item.assetsId]['name']}{else}--{/if}</td>
                <td>{if $item.importRecordId}{$importRecordId}{else}--{/if}</td>
                <td>{$item.upload_num}</td>
                <td>{if $item.submitStatus==3}{$item.handel_num}{else}--{/if}</td>
                <td>{if $item.handelType==1}案件撤回{else}重新分配{/if}</td>
                <td>{if $item.submitStatus==1}待提交{elseif $item.submitStatus==2}处理中 {elseif $item.submitStatus==3}处理完成 {/if}</td>
                <td>{$item.desc}</td>
                <td>{$item.mediatorName}</td>
                <td>{$item['addTime']|date_format:"%Y-%m-%d %H:%M:%S"}</td>
                <td class="fix-ele">
                    {if $item.submitStatus != 1}
                        <font color="#8c8c8c">确定处理</font>
                    {else}
                        <a class="delentry"  id="submitRecord" data-id="{$item['id']}">确定处理</a>
                    {/if}
                    {if $item.submitStatus == 1}
                    <a  class="delentry" id="deleteRecord"  data-id="{$item.id}">删除</a>
                    {/if}

                </td>
            </tr>
        {/foreach}
    {/if}
    </tbody>
    </table>
    </div>
    <div class="clearfix pad-no text-nowrap" style="margin-top: 20px;">
        {include file="base/pagenav.html"  action="/bashhandel/index" pagenum=$curPageNum inline}
        <select class="form-control" id="paglimit" style="float:right;margin:0 10px;width: auto;margin-top: -5px;">
            <option value="limit=10" {if $query.limit==10}selected="selected"{/if}>10条/页</option>
            <option value="limit=20" {if $query.limit==20}selected="selected"{/if}>20条/页</option>
            <option value="limit=50" {if $query.limit==50}selected="selected"{/if}>50条/页</option>
            <option value="limit=100" {if $query.limit==100}selected="selected"{/if}>100条/页</option>
        </select>
        <span style="float:right;">共 {$totalnum} 条</span>
    </div>
</div>


    <div class="modal fade" id="modal_withdraw_case" tabindex="-1" role="dialog" aria-labelledby="confirmLabel">
        <div class="modal-dialog modal-dialog-centered" role="document" style="background:#FFF;">
            <div class="">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="exampleModalLabel">批量撤案</h4>
                    </div>
                    <form  class="form-inline" id="withdraw_form">
                        <div class="clearfix modal-body">
                            <div class="form_dialog form-group col-sm-12" >
                                <label for="exampleInputName2"  class="col-sm-3 control-label">资产方:</label>
                                <div class="col-sm-7">
                                    <select class="form-control selectpicker" name="assetsId" title="请选择">
                                       {foreach from=$assets item=item key=key}
                                            <option class="u144_input_option" value="{$item.id}">{$item.name}</option>
                                        {/foreach}
                                    </select>
                                </div>
                            </div>
                            <div class="form_dialog form-group col-sm-12" style="margin-top:15px">
                                <label for="exampleInputName2" class="col-sm-3 control-label">导入批次ID:</label>
                                <div class="col-sm-7">
                                    <input type="text" style="width:100%" class="form-control" name="importRecordId" placeholder="请输入导入批次id，多个英文逗号隔开">
                                </div>
                            </div>
                            <div class="form_dialog form-group col-sm-12" style="margin-top:15px">
                                <label for="exampleInputName2"  class="col-sm-3 control-label"><span style="color: red">*</span>撤案类型:</label>
                                <div class="col-sm-7">
                                    <select class="form-control selectpicker" name="fileType">
                                        <option class="u144_input_option" value="0">请选择</option>
                                        <option class="u144_input_option" value="1">留案数据</option>
                                        <option class="u144_input_option" value="2">撤案数据</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form_dialog form-group col-sm-12" style="margin-top:15px">
                                <label for="exampleInputName2"  class="col-sm-3 control-label"><span style="color: red">*</span>表数据内容:</label>
                                <div class="col-sm-7">
                                    <select class="form-control selectpicker" name="contentType">
                                        <option class="u144_input_option" value="0">请选择</option>
                                        <option class="u144_input_option" value="1">身份证号码</option>
                                        <option class="u144_input_option" value="2">合同编号</option>
                                        <option class="u144_input_option" value="3">案件标识号</option>
                                    </select>
                                </div>
                            </div>

                            <div class="form_dialog form-group col-sm-12 ui-select" style="margin-top:15px;">
                                <label for="exampleInputName2"  class="col-sm-3 control-label"><span style="color: red">*</span>上传文件:</label>
                                <!-- submit                   -->
                                <div style="color:#fa5460;display: flex;flex-direction: column;align-items: center;margin: 20px 0;position: relative;">
                                    <i class="glyphicon glyphicon-file" style="font-size: 35px;"></i>
                                    <span>上传文档</span>
                                    <input type="file" class="uploadFile" id="upfile" style="opacity: 0;position: absolute;left: 0;top: 0;right: 0;bottom: 0;cursor: pointer;">
                                </div>
                            </div>
                            <div style="margin-top: 10px;width: 85%;padding-left:3%;line-height: 20px;">
                                <span style="color:#ff6873;background-color:#ffdbe2;">&nbsp;· 注：资产方和导入批次id必须有其中一个条件，导入批次id可个，用英文逗号隔开，若条件匹配匹配多个数据，则全部撤案&nbsp;&nbsp;</span>
                            </div>
                        </div>
                    </div>
                </form>
              <div class="modal-footer">
                  <a type="button" href="/bashhandel/downTemplate?type=1" style="float: left;" class="btn btn-default left downTemplate">下载模板</a>
                  <button type="button" id="importWithdrawSubmit" class="btn btn-primary">确定</button>
                  <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
              </div>
          </div>
      </div>
    <div class="modal fade" id="modal_reallocate_case" tabindex="-1" role="dialog" aria-labelledby="confirmLabel">
    <div class="modal-dialog modal-dialog-centered" role="document" style="background:#FFF;">
        <div class="">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="exampleModalLabel">批量分配</h4>
            </div>
            <form  class="form-inline" id="reallocate_form">
                <div class="clearfix modal-body">
                    <div class="form_dialog form-group col-sm-12" >
                        <label for="exampleInputName2"  class="col-sm-3 control-label">资产方:</label>
                        <div class="col-sm-7">
                            <select class="form-control selectpicker" name="assetsId" title="请选择">
                                {foreach from=$assets item=item key=key}
                                <option class="u144_input_option" value="{$item.id}">{$item.name}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <div class="form_dialog form-group col-sm-12" style="margin-top:15px">
                        <label for="exampleInputName2" class="col-sm-3 control-label">导入批次ID:</label>
                        <div class="col-sm-7">
                            <input type="text" style="width:100%" class="form-control" name="id" placeholder="请输入导入批次id，多个英文逗号隔开">
                        </div>
                    </div>
                    <div class="form_dialog form-group col-sm-12" style="margin-top:15px">
                        <label for="exampleInputName2"  class="col-sm-3 control-label"><span style="color: red">*</span>表数据内容:</label>
                        <div class="col-sm-7">
                            <select class="form-control selectpicker" name="contentType">
                                <option class="u144_input_option" value="0">请选择</option>
                                <option class="u144_input_option" value="1">身份证号码</option>
                                <option class="u144_input_option" value="2">合同编号</option>
                                <option class="u144_input_option" value="3">案件标识号</option>
                            </select>
                        </div>
                    </div>

                    <div class="form_dialog form-group col-sm-12 ui-select" style="margin-top:15px;">
                        <label for="exampleInputName2"  class="col-sm-3 control-label"><span style="color: red">*</span>上传文件:</label>
                        <!-- submit                   -->
                        <div style="color:#fa5460;display: flex;flex-direction: column;align-items: center;margin: 20px 0;position: relative;">
                            <i class="glyphicon glyphicon-file" style="font-size: 35px;"></i>
                            <span>上传文档</span>
                            <input type="file" class="uploadFile" id="upfilereallocate" style="opacity: 0;position: absolute;left: 0;top: 0;right: 0;bottom: 0;cursor: pointer;">
                        </div>
                    </div>
                    <div style="margin-top: 10px;width: 85%;padding-left:3%;line-height: 20px;">
                        <span style="color:#ff6873;background-color:#ffdbe2;">&nbsp;· 注：资产方和导入批次id必须有其中一个条件，导入批次id可个，用英文逗号隔开，若条件匹配匹配多个数据，则全部分配，系统根据人名分配，若分配人员有重名，建议修改之后再上传，如：张三1 张三&nbsp;&nbsp;</span>
                    </div>
                </div>
        </div>
        </form>
        <div class="modal-footer">
            <a type="button" href="/bashhandel/downTemplate?type=2" style="float: left;" class="btn btn-default left downTemplate">下载模板</a>
            <button type="button" id="importReallocateSubmit" class="btn btn-primary">确定</button>
            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
        </div>
    </div>
</div>

  </div>

{/block}
{block name="page_scripts"}
<script type="text/javascript" src="/js/mediation/bashhandel/index.min.js" init="mediation/bashhandel/index"></script>
<script type="text/javascript">
    function GetQueryString(name){
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);

        if(r!=null)return  unescape(r[2]); return null;
    }
    $('body')
        .on('change','#paglimit', function(){

            var mediationOrganId = GetQueryString('mediationOrganId');
            var paglimit = GetQueryString('limit');
            var val =  $(this).val();

            if(!mediationOrganId){
                if(!paglimit){
                    window.location = window.location.href+'?'+val;
                } else{
                    window.location = window.location.href.replace('limit='+paglimit,val);
                }
            }else{
                if(!paglimit){
                    window.location = window.location.href+'&'+val;
                } else{
                    window.location = window.location.href.replace('limit='+paglimit,val);
                }
            }
        })

</script>

{/block}
